﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using DTO;
namespace BUS
{
   public class LEVELBUS
    {
        public static void Insert(LEVEL Username)
        {
            LEVELDAL l = new LEVELDAL();
            l.Insert(Username);

        }
        public static void Update(LEVEL username)
        {
            LEVELDAL l = new LEVELDAL();
            l.Update(username);
        }
        public static void Delete(int Ma)
        {
            LEVELDAL l = new LEVELDAL();
            l.Delete(Ma);
        }
        public static LevelColection GET(string Where, int PageIndex, int PageSize,
                                          string OrderBy, string OrderDirection,
                                          out int TotalRecords)
        {
            LEVELDAL lvDAL = new LEVELDAL();
            return lvDAL.GET(Where, PageIndex, PageSize, OrderBy, OrderDirection, out TotalRecords);
        }
        public static LEVEL GetByID(int MA)
        {
            int t = 0;
            LEVELDAL lvDAL = new LEVELDAL();
            LevelColection lvcl = lvDAL.GET("where " + LevelColumns.Ma.ToString() + " = " + MA.ToString(), 0, 0,
               LevelColumns.Username.ToString(), "ASC", out t);
            if (lvcl.Count == 1)
                return lvcl[0];
            return null;
        }

        public static LevelColection GetAll()
        {
            int t = 0;
            LEVELDAL lvDAL = new LEVELDAL();
            return lvDAL.GET("where 1=1", 0, 10, LevelColumns.Username.ToString(), "ASC", out t);
        }
    }
}
